package com.gzhryc.weixin.api;

import java.util.Date;

import org.apache.commons.lang3.StringUtils;

/**
 * 微信公共平台API返回消息
 * @author 张浩
 * @version 0.3.8
 */
public class DefaultApiResponse {

	public Integer errcode;
	public String errmsg;
	public Date createDate; //非接口定义，内部试用
	
	public DefaultApiResponse(){
		this.createDate = new Date();
	}
	
	public Integer getErrcode() {
		return errcode;
	}
	public void setErrcode(Integer errcode) {
		this.errcode = errcode;
	}
	public String getErrmsg() {
		return errmsg;
	}
	public void setErrmsg(String errmsg) {
		this.errmsg = errmsg;
	}
	public Date getCreateDate() {
		return createDate;
	}
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}
	
	/**
	 * 判断API响应是否是错误信息
	 * @param result
	 * @return
	 */
	public static boolean is(String result){
		return StringUtils.contains(result, "errcode");
	}
}
